package com.example.yuntiku.Servlet;

import com.example.yuntiku.Vo.ExamVo;
import com.example.yuntiku.dao.ExamDao;
import com.example.yuntiku.dao.impl.ExamDaoImpl;
import com.example.yuntiku.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

//使用三元
@WebServlet(name = "TonyiCeshiQianServlet", value = "/TonyiCeshiQianServlet")
public class TonyiCeshiQianServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
       User user = (User) request.getSession().getAttribute("user");

        ExamDao examDao = new ExamDaoImpl();
        List<ExamVo> examVos = examDao.selectByUserId(user.getUid());
        request.setAttribute("examVos",examVos);

        request.getRequestDispatcher("Tongyiceshiqian.jsp").forward(request,response);

    }
}